package com.ef.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.ReplicationMode;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;

import com.ef.util.CustomExample;
import com.ef.util.PaginationSupport;

 
public interface Dao<T> {
 
	public T uniqueResult(List<T> items);
 
	public int countByCriteria(final DetachedCriteria detachedCriteria);

	public int countByExample(final CustomExample<T> example);

	public void delete(T entity);

	public void deleteAll(Collection<T> entities);

	public void evict(T entity);

	public List<T> findAll();

	public PaginationSupport<T> findAll(final int startIndex, final int pageSize);

	public List<T> findAllByCriteria(final DetachedCriteria detachedCriteria);
	
	public List<T> findAllByCriteria(final DetachedCriteria detachedCriteria,final int max);
	
	public List<T> findMultiAll(final String hql, final int startIndex, final int numPerPage);
	
	public List<T> findByCriteria(Criterion... criterion);

	public T findById(Serializable id);

	public PaginationSupport<T> findPageByCriteria(
			final DetachedCriteria detachedCriteria, final int startIndex,
			final int pageSize);

	public PaginationSupport<T> findPageByCriteria(
			final DetachedCriteria detachedCriteria, final Order[] orders,
			final int startIndex, final int pageSize);

	public PaginationSupport<T> findPageByExample(
			final CustomExample<T> example, final int startIndex,
			final int pageSize);

	public PaginationSupport<T> findPageByExample(
			final CustomExample<T> example, final Order[] orders,
			final int startIndex, final int pageSize);

	public void flush();

	public int getCountByCriteria(final DetachedCriteria detachedCriteria);

	public Class<T> getEntityClass();

	public void merge(T entity);

	public void persist(T entity);

	public void refresh(T entity);

	public void replicate(T entity, ReplicationMode replicationMode);

	public void save(T entity);

	public void saveOrUpdate(T entity);

	public void saveOrUpdateAll(Collection<T> entities);

	public void update(T entity);
	
	public void clear();
}
